<%-- Created by IntelliJ IDEA. --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


<!DOCTYPE html>
<html>
<head lang="en">

    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="${pageContext.request.contextPath}/css/jobApplication.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dist/css/bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dist/css/bootstrap-theme.css">
    <script src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>
    <script src="${pageContext.request.contextPath}/dist/js/bootstrap.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/head.css">

    <script src="${pageContext.request.contextPath}/layui/layui.js" charset="utf-8"></script>

    <title>简历中心</title>

</head>
<script>

    function iframe(){
        var sms = "";//接收session中的信息
        var perName = $("#perName").val();
        console.log(perName)
        $.ajax({
            url: "${pageContext.request.contextPath}/login/index",
            type: "post",
            data:{   //数据传输到服务器

            },
            dataType:"json",

            success:function (result) {
                sms = result.data;
                console.log(sms);
                if(sms != null){

                    perName = sms.perName;
                    console.log(perName);
                    $(".dropbtn").children(":first").children(":last-child").hide();
                    var perName1 = $(".dropbtn").append($(".dropbtn").children(":first").children(":first").text());
                    console.log(perName1);
                    perName1.text(perName)
                    // perName1.html(regist)

                }else {
                    $(".dropdown").children(":last-child").hide();
                    $(".dropdown").children(":first").children(":first").children("img").hide();
                }

            }


        });
        $.ajax({
            url:"${pageContext.request.contextPath}/resumeCenter/rendering",
            type:"post",
            data:{
            },
            dataType:"json",
            success:function (result1) {
                var temp = result1.data;
                // var temp2 = $(".resumesChange");
                var resumeName = ""; //简历名
                var readStatus = "";//简历公开状态
                var  resumesId = "";//简历id
                var resumesStatus = "";//简历状态（0：代表已经删除，1：代表没有删除）
                console.log("简历集合"+temp);//输出查询到的简历集合
                //===================动态渲染简历信息
                for(var i = 0; i < temp.length;i++){
                    resumeName = temp[i].resumeName;
                    resumesId = temp[i].resumeId;

                    var el = "<option class=\"ef\"  readonly=\"readonly\" value=\"\" ></option>";
                    $(".resumeName").append(el)
                    var resumeNameText = $(".resumeName").children(":last-child").text(resumeName);
                    var resumeIdText = $(".resumeName").children(":last-child").val(resumesId);

                }
            }
        })
    }
</script>
<body onload="iframe()">

<jsp:include page="../head.jsp"></jsp:include>
<div class="tCompanyPage"style="background-color: #ffffff;width:100%;">
    <img src="${pageContext.request.contextPath}/images/job-top.jpg" style="margin-left: 100px">
    <div class="tCompany_centet clearfix">
        <div class="tHeader tHjob" style="display: block">
            <div class="in">
                <div class="cn" >
                    <h1 class="recName" value="${recruit.recId}">${recruit.recName}</h1>
                    <strong>${recruit.recJobSalary}</strong>
                    <p class="cname">
                        <a href="${pageContext.request.contextPath}/recruit/${recruit.recId}" target="_blank"class="catn" >${company.companyName}
                            <em class="icon_b_i_link"></em></a>
                        <a track-type="jobsButtonClick"event-type="2"class="i_house"href="${pageContext.request.contextPath}/recruit/${recruit.recId}"
                           target="_blank">查看所有职位</a>
                    </p>
                    <p class="msg ltype" title="苏州-高新区&nbsp;&nbsp;|&nbsp;&nbsp;5-7年经验&nbsp;&nbsp;|&nbsp;&nbsp;大专&nbsp;&nbsp;|&nbsp;&nbsp;招若干人&nbsp;&nbsp;|&nbsp;&nbsp;09-21发布">${company.compayAddress}&nbsp;&nbsp;<span>|</span>&nbsp;&nbsp;${recruit.recJobExperience}&nbsp;&nbsp;<span>|</span>&nbsp;&nbsp;${recruit.education}&nbsp;&nbsp;<span>|</span>&nbsp;&nbsp;招若${recruit.recPerNum}&nbsp;&nbsp;<span>|</span>&nbsp;&nbsp;<fmt:formatDate value="${recruit.recCreateTime}" pattern="yyyy-MM-dd"/>发布</p>
                    <div class="jtag">
                        <div class="t1">
                            <span class="sp4">五险一金</span><span class="sp4">餐饮补贴</span><span class="sp4">年终奖金</span>                                        <div class="clear"></div>
                        </div>
                    </div>
                </div>
                <div class="op">
                    <div class="op" style="border-color: #00a0e9;margin-left: -20px;">
                        <select id="resumeName" class="resumeName" onchange="show_sub()" style="width: 80px">
                            <option class="ef"  readonly="readonly" value="申请职位" >选择简历</option>

                        </select>
                      <%--  <button data-method="notice" class="layui-btn" style="margin-top: -6px;width: 82px;  background-color: #ff8c00;" id="joinl">申请简历</button>--%>
                        <button data-method="notice"  id="apply_job" onclick="applyjob()"
                                style="width: 100px;  height:40px;background-color: #ff8c00;border: none;color:white" >
                            申请简历
                        </button>

                        <span style="margin-top: 10px"> <a  onclick="collection()" class="icon_b i_collect" >收藏</a></span>
                        <div id="applyjob_msg" style="font-size: 18px; color: #FF8C00;  width: 200px; height: 30px;line-height: 30px;"></div>
                        <div class="clear"></div>
                    </div>
                </div>


            </div>
        </div>
        <div class="line1" style="background-color: #636985;height: 1px;width: 1100px;margin-top: 170px;margin-left: 90px;"></div>
        <!--职位信息-->

    </div>
    <div>
        <div class="tCompany_main">
            <div class="tBorderTop_box"style="background-color: #f5f5f5;width: 666px;">
                <h2><span class="bname">职位信息</span></h2>
                <div class="bmsg job_msg inbox">
                    ${recruit.jobIntroduction}
                    <br>
                    <p>任职要求</p>
                    ${recruit.jobDemand}
                </div>
            </div>
            <div class="tBorderTop_box"style="background-color: #f5f5f5;width: 666px;height: 130px">
                <h2>
                    <span class="bname">联系方式</span>
                </h2>
                <div class="bmsg inbox">
                    <p class="fp">
                        <span class="label">上班地址:</span>
                        ${recruit.recJobAddress}
                    </p>
                    <a href="${pageContext.request.contextPath}/indexAndSearch/address.jsp">查看地图</a>
                </div>
            </div>
            <!--公司详细信息-->
            <div class="tBorderTop_box"style="background-color: #f5f5f5;width: 666px;margin-left: 2px">
                <h2><span class="bname"style="float: left">&nbsp;公司信息</span></h2>
                <br>
                <div class="tmsg inbox">
                    ${company.companyIntroduction}
                </div>
            </div>
        </div>
        <!--右侧公司框-->
        <%--<div class="tCompany_sidebar" >
            <div class="tBorderTop_box" style="margin-top:590px;margin-left: -28px"  >
                <span class="bname"> 公司信息</span>

                <a class="com_name himg" target="_blank" href="${pageContext.request.contextPath}/recruit/${recruit.recId}">
                    <img src="${pageContext.request.contextPath}/images/job-company.gif" width="63" height="63" alt="" >
                    <p title=""style="margin-top: -40px" value="${company.companyId}">${company.companyName}</p></a>
                <br><br>
                <div class="com_tag">
                    <p class="at" title="民营公司">${company.companyType}</p>
                    <p class="at" title="少于50人">${company.companySize}</p>
                    <p class="at" >

                        ${company.websiteCompany}
                    </p>
                </div>
                <a href="${pageContext.request.contextPath}/indexAndSearch/company.jsp" class="icon_b i_house"  target="_blank">查看所有职位</a>
            </div>
        </div>--%>


    </div>
</div>
<div class="main-bottom"></div>
<div class="bottom">
    <div class="bottom1">
        <li><strong>联系方式：1383838438</strong></li>
        <li>Email：NaXian.com（公司）</li>
        <li>13843843@qq.com（个人）</li>
    </div>
    <div class="bottom2">
        <ul>
            <li><strong>简介</strong></li>
            <li> 关于我们</li>
            <li> 服务声明</li>
            <li>媒体报道</li>
            <li> Investor Relations</li>
        </ul>
    </div>
    <div class="bottom3">
        <ul>
            <li><strong>合作</strong></li>
            <li> 加入我们</li>
            <li> 联系我们</li>
            <li>友情链接</li>
        </ul>

    </div>
    <div class="bottom4">

        <ul>
            <li><strong>帮助</strong></li>
            <li> 帮助中心</li>
            <li> 常见问题</li>
            <li>新手引导</li>
        </ul>
    </div>
    <div class="bottom5">

        <ul>
            <li><strong>导航</strong></li>
            <li> 网站地图</li>
            <li> 职位搜索</li>
            <li>简历中心</li>
            <li> 企业名录</li>
        </ul>
    </div>
    <div class="bottom6">
        <img src="${pageContext.request.contextPath}/images/NaXian.png">
        <p>服务号</p>
    </div>
</div>
<script>

    $("#applyjob_msg").text("");
    //收藏功能
    function collection() {

        var recId = $(".recName").attr('value');
        $.ajax({
            url:"${pageContext.request.contextPath}/jobApplication/collection",
            data:{
                "recId":recId,
            },
            dataType:"json",
            success:function (result3) {
                var mycollection = result3.data;
                console.log("收藏的对象"+mycollection)
                if(mycollection!=null) {
                    alert("职位收藏成功")
                }else {
                    alert("职位收藏失败")
                }
            }
        })

    }

    //改过的获得下拉框中的值
    function show_sub(){
        // console.log($("#resumeName").find("option:selected").attr("value"));//原生
        var getSelectResumeId = ($("#resumeName").find("option:selected").val());  //加入jq库获得简历下拉框中选中的value
        console.log("获得的简历id"+getSelectResumeId);
        var getSelectResumeName = ($("#resumeName").find("option:selected").text());  //加入jq库获得简历下拉框中选中的text
        // console.log(getSelectResumeName);
        var recId = $(".recName").attr('value');
        console.log("获得的职位id"+recId)
        layui.use('layer', function(){ //独立版的layer无需执行这一句
            var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
            //触发事件
            var lotNum = 1234;
            var urlSrt = "";
            urlSrt = "${pageContext.request.contextPath}/jobApplication/application?resumeId="+getSelectResumeId+"&recId="+recId;


            var active = {

                notice: function(cusId){
                    //示范一个公告层
                    layer.open({

                        type: 1
                        ,title: false //不显示标题栏
                        ,closeBtn: false
                        ,area: '300px;'
                        ,shade: 0.8
                        ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
                        ,btn: ['是否确认提交申请','取消选择']
                        ,btnAlign: 'c'
                        ,moveType: 1 //拖拽模式，0或者1
                        ,content: '<div class="youhuiquan" style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;"><span>确认提交把++申请此职位吗</span></div>'
                        ,success: function(layero){
                            var btn = layero.find('.layui-layer-btn');
                            btn.find('.layui-layer-btn0').attr({
                                href: urlSrt                                  //跳转的页面
                                ,target: '_self',
                            });
                            // lot2lot();
                        }
                    });
                }
            };
            $('#layerDemo .layui-btn').on('click', function(){
                var othis = $(this), method = othis.data('method');
                active[method] ? active[method].call(this, othis) : '';
            });
        });

    }


    function applyjob() {
        //已选择的简历id
        var getSelectResumeId = ($("#resumeName").find("option:selected").val());
        console.log("已选择的简历id："+getSelectResumeId);
        var getSelectResumeName = ($("#resumeName").find("option:selected").text());  //加入jq库获得简历下拉框中选中的text

        var recId = $(".recName").attr('value');
        var applyJobUrl= "${pageContext.request.contextPath}/jobApplication/application?resumeId="+getSelectResumeId+"&recId="+recId;

        $.ajax({
            url:applyJobUrl,
            type:"post",
           datatype:"json",
            success:function (result) {
            if(result.code ==0){
                $("#applyjob_msg").text(result.message);
            }else{
                $("#applyjob_msg").text(result.message);
            }
            }


        })


    }


</script>




</body>
</html>



</body>
</html>

